CC=gcc
CFLAGS=-Wall -ggdb -std=c99 -pedantic-errors -D_GNU_SOURCE
GCFLAGS=`pkg-config --cflags glib-2.0`
GLIBS=`pkg-config --libs glib-2.0`
LIBFLAGS=-L../../types/ -ltypes -L.. -lparser
TARGETS=Lexer

all: $(TARGETS)

%: %.c
	cd ..; make
	$(CC) $(CFLAGS) $(GLIBS) $(GCFLAGS) $(LIBFLAGS) $< -o $@

clean:
	rm -f *.o $(TARGETS)
	
run: $(TARGETS)
	@for target in $(TARGETS); do \
		echo -------------------------; \
		echo Running ./$$target; \
		LD_LIBRARY_PATH=..:../../types/ gdb --batch -ex ru -ex bt $$target; \
	done
